package com.tc.dispatch.csservice.model;

import java.io.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2008</p>
 * <p>Company: zju</p>
 * @author jakcyjia
 * @version 1.0
 */

public class Product
    implements Serializable {
  private String ssign;
  private String spec;
  private String plate;
  private int month1;
  private int year1;
  private int factory;
  private String specType;
  private int scheme;
  private String id;
  public Product() {
  }

  public Product(String ssign, String spec, String plate) {
    this.ssign = ssign;
    this.spec = spec;
    this.plate = plate;
  }

  public Product(String ssign, String spec, String plate, int month1, int year1,
		 int factory, String specType, int scheme) {
    this.ssign = ssign;
    this.spec = spec;
    this.plate = plate;
    this.month1 = month1;
    this.year1 = year1;
    this.factory = factory;
    this.specType = specType;
    this.scheme = scheme;
  }

  public boolean equals(Object o) {
    if (o instanceof Product) {
      Product b = (Product) o;
      if (b.getId().equals(this.getId())) {
	return true;
      }
      else {
	return false;
      }
    }
    else {
      return false;
    }
  }

  public String toString() {

    return super.toString();
  }

  public int hashCode() {

    return this.scheme;
  }

  private void readObject(ObjectInputStream ois) throws ClassNotFoundException,
      IOException {
    ois.defaultReadObject();
  }

  private void writeObject(ObjectOutputStream oos) throws IOException {
    oos.defaultWriteObject();
  }

  public String getSsign() {
    return ssign;
  }

  public void setSsign(String ssign) {
    this.ssign = ssign;
  }

  public String getSpec() {
    return spec;
  }

  public void setSpec(String spec) {
    this.spec = spec;
  }

  public String getPlate() {
    return plate;
  }

  public void setPlate(String plate) {
    this.plate = plate;
  }

  public int getMonth1() {
    return month1;
  }

  public void setMonth1(int month1) {
    this.month1 = month1;
  }

  public int getYear1() {
    return year1;
  }

  public void setYear1(int year1) {
    this.year1 = year1;
  }

  public int getFactory() {
    return factory;
  }

  public void setFactory(int factory) {
    this.factory = factory;
  }

  public String getSpecType() {
    return specType;
  }

  public void setSpecType(String specType) {
    this.specType = specType;
  }

  public int getScheme() {
    return scheme;
  }

  public void setScheme(int scheme) {
    this.scheme = scheme;
  }

  public String getId() {

    return ssign + "-" + spec + "-" + plate + "-" + specType + "-" + scheme;
  }

  public void setId(String id) {
    this.id = id;
  }

}